package org.ecpkn.PAGridSim.core.gridsimEntity.policy.paPolicy.preemptable;

import java.util.Comparator;

import gridsim.ResGridlet;
import gridsim.ResGridletList;

public interface Preemptable {

	/**
	 * Realize a preemption process
	 * 
	 * @param pauseGlNum
	 *            the number in the gridletInExecList_ of the gridlet to be
	 *            preempted
	 * @param rglPreempt
	 *            the rgl that we to preempt the pauseGl
	 */
	public void preemptionProcesse(ResGridlet rglToBePreempted,
			ResGridlet rglPreempt);

	/**
	 * Decide whether to preempt a gl in execution
	 * 
	 * @param inComingRgl
	 *            the gl that wants to preempt
	 * @return the number of gl to be preempted or Const.JOB_HAS_NO_PRIORITY
	 *         means that the rgl has no priority compared to the others in list
	 */
	public ResGridlet preemptionDecision(ResGridlet inComingRgl,
			Comparator<ResGridlet> comparator, ResGridletList rgList);

	/**
	 * should be implemented by a child class
	 * 
	 * @return
	 */
	public Comparator<ResGridlet> getPriorityComparator();
}
